import {createRouter, createWebHistory} from 'vue-router'
import {constantRoutes} from './routes'

const router = createRouter({
    history: createWebHistory(),
    routes: constantRoutes
})

router.beforeEach((to, from, next) => {
    // var valid = ['/index', '/user/profile']
    // if (valid.indexOf(to.fullPath) !== -1) {
    //     next()
    // } else if (to.query.name) {
    //     to.query = {}
    //     to.meta.name = 1
    //     next()
    // } else if (to.meta.name) {
    //     next()
    // } else {
    //     next(false)
    // }
    next()
})

export default router
